package com.base.utils;

import android.util.Log;

/**
 * 日志输出工具类
 * Created by Android on 2017/3/6 0006.
 */

public class LogUtil {
    private static boolean isDebug = true;
    private static int LOG_MAXLENGTH = 2000;

    public static void log_e(String tag, String log) {
        if (isDebug) {
            Log.e(tag, log);
        }
    }

    public static void log_v(String tag, String log) {
        if (isDebug) {
            Log.v(tag, log);
        }
    }

    public static void log_d(String tag, String log) {
        if (isDebug) {
            Log.d(tag, log);
        }
    }

    public static void e(String tagName, String msg) {
        if (isDebug) {
            int strLength = msg.length();
            int start = 0;
            int end = LOG_MAXLENGTH;
            for (int i = 0; i < 100; i++) {
                if (strLength > end) {
                    Log.e(tagName + i, msg.substring(start, end));
                    start = end;
                    end = end + LOG_MAXLENGTH;
                } else {
                    Log.e(tagName + i, msg.substring(start, strLength));
                    break;
                }
            }
        }
    }
}
